// MathWrap.h
//
#ifndef MATHWRAP_ONCE
#define MATHWRAP_ONCE

//#define GLM_SWIZZLE
#include "glm.hpp"
//#include "ext.hpp"

#include "gtc/quaternion.hpp"
#include "gtc/matrix_transform.hpp"
#include "gtc/matrix_access.hpp"
#include "gtc/matrix_inverse.hpp"
#include "gtc/type_ptr.hpp"
#include "gtc/type_precision.hpp"

//#include "glm/detail/func_exponential.hpp"
//#include "detail/func_common.hpp"
//#include "detail/type_vec2.hpp"
//#include "detail/type_vec4.hpp"
//#include "detail/type_float.hpp"

namespace Math = glm;

namespace glm {
	template < typename T, precision P>
	GLM_FUNC_QUALIFIER typename detail::tvec2<T,P>::value_type
	angleBetween( const detail::tvec2<T,P> &d, const detail::tvec2<T,P> &u  )
	{
		typename detail::tvec2<T,P>::value_type angle =  atan2( u.y,u.x ) - atan2( d.y,d.x );
		while(angle >   pi<double>() ) angle -= pi<double>()*2.0;
		while(angle <= -pi<double>() ) angle += pi<double>()*2.0;
		return angle;
	}

	template < typename T, precision P >
	GLM_FUNC_QUALIFIER typename detail::tvec3<T,P>::value_type
	angleBetween( const detail::tvec3<T,P> &d, const detail::tvec3<T,P> &u  )
	{
		typename detail::tvec3<T,P>::value_type angle =  atan2( u.y,u.x ) - atan2( d.y,d.x );
		while(angle >   pi<double>() ) angle -= pi<double>()*2.0;
		while(angle <= -pi<double>() ) angle += pi<double>()*2.0;
		return angle;
	}
}

#endif